import baseRequest from "@/axios/baseRequest"
// import config from "@/config/config"
export default {
  addNewPvCluster(params) {
    return new Promise((resolve, reject) => {
      baseRequest.post("/bigdata-pv-backend/stationManage/stringInfo/insertStringInfo", params).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  getmatrixNummberByCompany(params) {
    return new Promise((resolve, reject) => {
      baseRequest.get("/bigdata-pv-backend/stationManage/arrayInfo/listArrayInfoOption?stationCode=" + params.stationCode).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  updatePvCluster(params) {
    return new Promise((resolve, reject) => {
      baseRequest.put("/bigdata-pv-backend/stationManage/stringInfo/updateStringInfo", params).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  getList(params) {
    let paramStr = ''
    for (const key in params) {
      if (params[key]) {
        paramStr += [key] + '=' + params[key] + '&'
      }
    }
    const url = paramStr ? "/bigdata-pv-backend/stationManage/stringInfo/pageStringInfoList?" + paramStr : "/bigdata-pv-backend/stationManage/stringInfo/pageStringInfoList"
    return new Promise((resolve, reject) => {
      baseRequest.get(url).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  deletePvClutser(params) {
    return new Promise((resolve, reject) => {
      baseRequest.delete("/bigdata-pv-backend/stationManage/stringInfo/deleteStringInfo", {
        data: params.ids
      }).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  getCompanyList() {
    return new Promise((resolve, reject) => {
      baseRequest.get("/bigdata-pv-backend/stationManage/listCompanyOption").then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  uploadPvCluster(params) {
    return new Promise((resolve, reject) => {
      baseRequest.post("/bigdata-pv-backend/stationManage/stringInfo/uploadInsertStringInfo", params).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  },
  getpvClusterByMrtrixNumber(params) {
    return new Promise((resolve, reject) => {
      baseRequest.get("/bigdata-pv-backend/stationManage/stringInfo/listStringInfoOption?pvArrayCode=" + params.pvArrayCode).then(data => {
        resolve(data)
      }).catch(e => {
        reject(e)
      })
    })
  }
}
